from common.conmysql import db
from common.read import read
from common.YamlUtil import YamlUtil
#查看用户下订单数量
def get_ordernum():
    mobile = read.read_yaml()["login_fixture"]["username"]
    sql = f'SELECT count(1) FROM `trade_orderinfo` where user_id=(select id from `users_userprofile` where mobile = {mobile});'
    result = db.select_db(sql)
    return result

#查询用户下单生成的订单号
def get_orderid():
    mobile = read.read_yaml()["login_fixture"]["username"]
    sql = f'SELECT id FROM `trade_orderinfo` where user_id=(select id from `users_userprofile` where mobile = {mobile}) order by add_time desc limit 1;'
    result = db.select_db(sql)
    return result

